package cn.edu.swufe.surverpark.util;

import java.text.DecimalFormat;
import java.util.Calendar;

/**
 *@author 陈龙 E-mail:529914446@qq.com
 *@version创建时间:2015年5月7日上午6:56:29
 *类说明
 */
public class LogUtil {

	public static String generateLogTableName(int offset) {
		Calendar c = Calendar.getInstance();
		
		int year = c.get(Calendar.YEAR);
		//1-12
		int month = c.get(Calendar.MONTH) + 1 + offset;
		
		while(month > 12){
			year ++;
			month -= 12;
		}
		while(month < 1){
			year --;
			month += 12;
		}
		DecimalFormat df = new DecimalFormat();
		df.applyPattern("00");
		return "logs_" + year + "_" + df.format(month);
	}

}

